﻿@using X.PagedList;
@using X.PagedList.Mvc.Core;
@using X.PagedList.Mvc.Common;
@using FwProject.Distribution.Dto
@using FwProject.Core.Distribution
@model IPagedList<DistributionDiffView>
@{
    Layout = null;
    int SumDistributioncount = 0;
    int SumRecoveryBycount = 0;
    int SumDiff = 0;
    int i = 0;
    if (Model.Count > 0)
    {
        if (Model.PageNumber != 1)
        {

            i = (Model.PageNumber - 1) * Model.PageSize;
        }
    }
}
<div id="table_print"  style="max-height:600px;overflow-y:scroll;">

    <table class="table table-bordered table-hover table-rowselected">
        <thead>
            <tr>
                <th style="width:45px">序号</th>
                <th>配送日期</th>
                <th>回收总数</th>
                <th>配送总数</th>
                <th>差件</th>
                @*<th style="width:200px;">操作</th>*@
            </tr>
        </thead>
        <tbody>
            @if (Model.Count == 0)
            {
                <tr><td class="text-center" colspan="5">暂无信息</td></tr>
            }
            else
            {
                foreach (var item in Model)
                {
                    i++;
                    <tr>
                        <td>@i</td>
                        <td>@item.DistributionDate.ToString("yyyy-MM-dd")</td>
                        <td>@item.Recoverycount</td>
                        <td>@item.Distributioncount</td>
                        <td>@item.Diff</td>
                    </tr>
                    SumDistributioncount += item.Distributioncount;
                    SumRecoveryBycount += item.Recoverycount;
                    SumDiff += item.Diff;
                }
                <tr class="footer">
                    <td style="color:red;text-align:center">合计</td>
                    <td></td>
                    <td style="color:red">@SumRecoveryBycount</td>
                    <td style="color:red">@SumDistributioncount</td>
                    <td style="color:red">@SumDiff</td>
                </tr>
            }
        </tbody>
    </table>

</div>
<div class="row pagedinfo">
    <div class="col-sm-5">
        @*共 @Model.TotalItemCount 条，@Model.PageSize 条/页 当前第 @Model.PageNumber/@Model.PageCount 页*@
        共 @Model.TotalItemCount 条，
        <select class="form-control" id="pageSize" style="width:70px;display:initial">
            @for (int z = 10; z < 100; z = z + 10)
            {
                if (z == Model.PageSize)
                {
                    <option selected value="@z">@z</option>
                }
                else
                {
                    <option value="@z">@z</option>
                }
            }
        </select> &nbsp;条/页 当前第 @Model.PageNumber/@Model.PageCount 页
    </div>
    <div class="col-sm-7">
        <input type="hidden" id="pageurl" value="&LineId=@(Context.Request.Query["LineId"])&DriverId=@(Context.Request.Query["DriverId"])&beginTime=@(Context.Request.Query["beginTime"])&endTime=@(Context.Request.Query["endTime"])" />
        @Html.PagedListPager(Model, page => Url.Action("DistributionDiff", new { pageIdx = page,size= Context.Request.Query["size"], LineId = Context.Request.Query["LineId"], DriverId = Context.Request.Query["DriverId"], beginTime = Context.Request.Query["beginTime"], endTime = Context.Request.Query["endTime"] }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions() { AllowCache = false, HttpMethod = "Get", UpdateTargetId = "data_list", OnSuccess = "AjaxSuccessCallback", OnBegin = "AjaxBegin" }))
    </div>
</div>